package com.suray.attendance.model.enums.erp;

/**
 * Description: erp中工厂编号和报工工单号的对应关系
 * Author: linyu
 * Date: 2023/11/8
 * AG 5142
 * HG 5132
 * SS 5114
 * SG 5122
 */
public enum FactoryOrderMapperEnum {

    AG("5142"),
    HG("5132"),
    SS("5114"),
    SG("5122");

    private String orderPrefix;

    FactoryOrderMapperEnum(String orderPrefix) {
        this.orderPrefix = orderPrefix;
    }

    public String getOrderPrefix() {
        return orderPrefix;
    }

    public void setOrderPrefix(String orderPrefix) {
        this.orderPrefix = orderPrefix;
    }

    public static String getFactoryCodeByOrderPrefix(String erpOrder) {
        FactoryOrderMapperEnum arrObj[] = FactoryOrderMapperEnum.values();
        for (FactoryOrderMapperEnum obj : arrObj) {
            if (obj.getOrderPrefix().equals(erpOrder.substring(0,4))) {
                return obj.name();
            }
        }
        return "";
    }
}
